package demo.utils;

import java.io.IOException;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Properties Utility.
 * 
 * @author Roger Xu
 * 
 */
public class PropertiesUtils {
    private static final Log log = LogFactory.getLog(PropertiesUtils.class.getSimpleName());

    private static Properties properties = null;
    static {
        try {
            properties = PropertiesLoader.loadProperties("derby.properties");
        } catch (final IOException e) {
            log.error("error when loading derby.properties", e);
            throw new IllegalStateException(e);
        }
    }

    public static void load(final String path) {
        try {
            properties = PropertiesLoader.loadProperties(path);
        } catch (final IOException e) {
            log.error("error when loading " + path, e);
            throw new IllegalStateException(e);
        }
    }
}
